<?php

/**
 * class ExporterController
 *
 * Description for class ExporterController
 *
 * @author:peter
*/


 Zend_Loader::loadClass("BaseControllerAuth");
 class ExporterController extends BaseControllerAuth
 {
 	public function initialize()
 	{
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		
		
		$auth = BaseAuth::getInstance();
	
		$this->setLayout("account");
		$this->assign("pageTitle","Trade Management System " . $this->getConfig()->client->name);
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		$this->assign("viewType",$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
		$this->assign("controller","exporter");
	
		if($userTypesArray[CodesUtility::USER_TYPE_EXPORTER] != $auth->user_type_id) {
			$this->deAuthenticate();
		}
 	}
	
	public function deAuthenticate()
 	{
		$auth = BaseAuth::getInstance();
		$auth->deAuthenticate();
 	}
	
	public function indexAction() {
	
		
		Zend_Loader::loadClass("CartUtility");
		Zend_Loader::loadClass("AuthUtility");
		Zend_Loader::loadClass("MenuUtility");
		Zend_Loader::loadClass("Organization");
		Zend_Loader::loadClass("Organizations");
		Zend_Loader::loadClass("AccountUtility");
		Zend_Loader::loadClass("CodesUtility");
		
		$acctUtility = new AccountUtility();
		
		$data = $acctUtility->getDashboard(CodesUtility::USER_TYPE_EXPORTER);
		
		
		$auth = BaseAuth::getInstance();
  		$this->assign("username",$auth->username);
		$organization = new Organization();
		$organization->loadWhere(" org_id = ". $auth->org_id);
		
		$menuUtility = new MenuUtility();
		
		$this->assign("data",$data);
		$this->assign("pageTitle","Trade Management System ". $organization->name );
		$this->assign("menuUtility" ,$menuUtility);
		$this->render("home.tpl");
		
	}
	
	public function homeAction(){
		Zend_Loader::loadClass("AccountUtility");
		Zend_Loader::loadClass("CodesUtility");
		
		$acctUtility = new AccountUtility();
		
		$data = $acctUtility->getDashboard(CodesUtility::USER_TYPE_EXPORTER);
	
		$this->setNoLayout();
		$this->assign("data",$data);
		$this->render("home.tpl");
	}
	
	public function createOrderAction(){
	
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
	
		$this->_redirect("/account/createorder/userType/".$userTypesArray[CodesUtility::USER_TYPE_IMPORTER]);
	}
	
	public function adminAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
	
		$this->_redirect("/account/adminProfile/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
		
	}
	
	public function organismlookupAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgOrganismLookup/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
		
	}
	
	public function availableOrganismAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgInventory/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function orgDAAReportAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgDAAReport/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function orgDOAReportAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgDOAReport/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function orgInvRejectReportAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgInvRejectReport/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function listofFMAAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/fmaList/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function staffMaintenanceAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgStaffs/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function skillsAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/skill/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function orgTrainingsAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/orgTraining/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function tankInspectionAction(){
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/tankInspection/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function tanksAction() {
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/tanks/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function staffTrainingsAction() {
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/staffTrainings/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function documentLibraryAction() {
		Zend_Loader::loadClass("UserTypes");
		Zend_Loader::loadClass("CodesUtility");
		$userTypes = new UserTypes();
		$userTypesArray = $userTypes->getUserTypesArray("code", "id");
		
		$this->_redirect("/account/documentLibrary/userType/".$userTypesArray[CodesUtility::USER_TYPE_EXPORTER]);
	}
	
	public function messagesAction() {
		
		$this->_redirect("/account/emailMessage/");
		
	}
	
	public function viewOrdersAction(){
		
		$this->_redirect("/account/viewOrders/");
		
	}
	
	public function blanketOrderAction(){
		
		$this->_redirect("/account/viewOrders/blanketpo/1");
		
	}
	
	public function receiptsAction(){
		$this->_redirect("/account/createors/");
	}
	
	public function createorsAction(){
		$this->_redirect("/account/createors/");
	}
	
	public function vieworsAction(){
		$this->_redirect("/account/viewors");
	}
	
	public function dispatchOrderAction(){
		$this->_redirect("/account/dispatchOrder");
	}
	
	public function viewDispatchOrderAction(){
		$this->_redirect("/account/viewDispatchOrder");
	}
	
	public function createsspAction(){
		$this->_redirect("/account/createssp");	
	}
	
	public function viewsspAction(){
		$this->_redirect("/account/viewssp");	
	}
	
	public function stockuploadingAction() {
		$this->_redirect("/account/stockuploading");
	}
	
	
 }
?>
